package tp.pr2;

public enum Direction {
	EAST, NORTH, SOUTH, WEST, UNKNOWN;

	/**
	 * Obtiene la direccion opuesta ( punto cardinal )
	 * 
	 * @return la direccion (enum) opuesta
	 */
	public Direction opposite() {
		switch (this) {
		case EAST: return WEST;
		case NORTH: return SOUTH;
		case SOUTH: return NORTH;
		case WEST: return EAST;
		default: return UNKNOWN;
		}
	}

	/**
	 * Obtiene una nueva direccion aplicando el parametro rotation (realiza el
	 * giro a derecha o izquierda)
	 * 
	 * @return la nueva direccion
	 */
	public Direction rotateLeft() {
		switch (this) {
		case EAST: return NORTH;
		case NORTH: return WEST;
		case SOUTH: return EAST;
		case WEST: return SOUTH;
		default: return UNKNOWN; 
		}
	}
	public Direction rotateRight() {
		switch (this) {
		case EAST: return SOUTH;
		case NORTH: return EAST;
		case SOUTH: return WEST;
		case WEST: return NORTH;
		default: return UNKNOWN; 
		}
	}
}
